//
//  ViewController.m
//  AlertViewTool
//
//  Created by XiaoMing on 16/2/24.
//  Copyright © 2016年 XiaoMing. All rights reserved.
//

#import "ViewController.h"
#import "MGYAlertView.h"
#import "MGYActionSheetView.h"
#import "BBAlertView.h"
#import "MGYShareSheetView.h"

//#import "BBCustomAlertView.h"


@interface ViewController ()<UIAlertViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self createUI];

}

- (void)createUI {
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 100, 100, 100);
    btn.backgroundColor = [UIColor redColor];
    btn.tag = 100;
    [btn setTitle:@"按钮1" forState:0];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn2.frame = CGRectMake(200, 200, 100, 100);
    btn2.backgroundColor = [UIColor redColor];
    btn2.tag = 101;
    [btn2 setTitle:@"按钮2" forState:0];
    [btn2 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn2];
    
    UIButton *btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn3.frame = CGRectMake(0, 200, 100, 100);
    btn3.backgroundColor = [UIColor redColor];
    btn3.tag = 102;
    [btn3 setTitle:@"按钮3" forState:0];
    [btn3 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn3];
    
    UIButton *btn4 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn4.frame = CGRectMake(100, 300, 100, 100);
    btn4.backgroundColor = [UIColor redColor];
    btn4.tag = 103;
    [btn4 setTitle:@"按钮4" forState:0];
    [btn4 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn4];
}

- (void)btnClick:(UIButton *)sender {
    if (sender.tag == 100) {
        [MGYAlertView alertShowTitle:@"提示" message:@"这是一个适配ios9的Alert" cancelButtonTitle:@"返回" otherButtonTitles:nil block:^(NSInteger buttonIndex) {
            NSLog(@"点击了%ld",(long)buttonIndex);
        }];
    }else if (sender.tag == 101) {
        MGYActionSheetView *actionSheetView = [MGYActionSheetView showActionSheetWithTitle:@"" cancelButtonTitle:@"取消" destructiveButtonTitle:@"" otherButtonTitles:@[@"测试1", @"测试2",@"测试3",] handler:^(MGYActionSheetView *actionSheetView, NSInteger buttonIndex) {
            NSLog(@"%zd", buttonIndex);
        }];
        [actionSheetView show];
    }else if (sender.tag == 102) {
        
        BBAlertView *alertView = [[BBAlertView alloc] initWithImage:[UIImage imageNamed:@"1"] initWithTitle:@"麦圈大侠" contentText:@"给你发了一个红包" messageText:@"生日快乐哇咔咔" centerbuttonTitle:@"拆红包"];
        [alertView show];
        
        
    }else if (sender.tag == 103){
        
        MGYShareSheetView * mgyvvv = [[MGYShareSheetView alloc]initWithSelectButtonBlock:^(NSInteger buttonIndex) {
            NSLog(@"%ld---",(long)buttonIndex);
        }];
        [mgyvvv show];
    }
}

@end
